package com.sgb.kjwl.view.ui.adapter.shopping;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.core.content.ContextCompat;

import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.GoodsSkuDetailEntity;
import com.sgb.kjwl.model.entity.website.GoodsParamDetailEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

/**
 * @author Administrator
 */
public class GoodsParamAdapter extends BaseRecycleAdapter<GoodsParamDetailEntity> {

    public GoodsParamAdapter(Context context, List<GoodsParamDetailEntity> data) {
        super(context, R.layout.item_goods_details_param, data);
    }

    @Override
    public void convert(ItemViewHolder holder, GoodsParamDetailEntity params) {
        View view = (View) holder.getView(R.id.item_container);
        if (holder.getIndex_position() == 0) {
            view.setBackground(ContextCompat.getDrawable(context,R.drawable.bg_goods_table_line_1));
        } else {
            view.setBackground(ContextCompat.getDrawable(context,R.drawable.bg_goods_table_line));
        }
        TextView tvKey = holder.getView(R.id.tv_key);
        tvKey.setText(params.getKey());

        TextView tvValue = holder.getView(R.id.tv_value);
        tvValue.setText(params.getValue());
    }
}
